package com.umanji.building.domain;

import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import com.umanji.generic.entity.UUIDEntity;
import com.umanji.user.domain.Members;

@Entity
@Table(name="umanji_public_official_building_admin")
public class PublicOfficialBuildingAdmins extends UUIDEntity<PublicOfficialBuildingAdmins> {

	// @OneToOne(cascade = CascadeType.ALL)
    @ManyToMany(
        targetEntity=Members.class,
        cascade={CascadeType.PERSIST, CascadeType.MERGE}
    )
    @JoinTable(
        name="POBADMIN_MEMBERS",
        joinColumns=@JoinColumn(name="POBADMIN_ID"),
        inverseJoinColumns=@JoinColumn(name="MEMBER_ID")
    )
	private List<Members> members;

	@ManyToOne
	@JoinColumn(name="POBUILDING_ID", insertable=false, updatable=false)
	private PublicOfficialBuildings publicOfficialBuilding;

	@Column(name="POSITION_NAME", length=150)
	private String position;

	@Column(name="ADMIN_LEVEL", length=5)
	private Integer level;

	@Temporal(TemporalType.DATE)
	private Date regDate;

	public Date getRegDate() {
		return regDate;
	}

	public void setRegDate(Date regDate) {
		this.regDate = regDate;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public void setPublicOfficialBuilding(PublicOfficialBuildings publicOfficialBuilding) {
		this.publicOfficialBuilding = publicOfficialBuilding;
	}

	public PublicOfficialBuildings getPublicOfficialBuilding() {
		return publicOfficialBuilding;
	}

	public void setMember(List<Members> members) {
		this.members = members;
	}

	public List<Members> getUser() {
		return members;
	}

}
